package com.rightsidetech.trade.mapper;

import com.rightsidetech.trade.dtos.response.TdBuyCarDetailDelResp;
import com.rightsidetech.trade.dtos.response.TdBuyCarDetailResp;
import com.rightsidetech.trade.dtos.response.TdBuyCarDetailZpResp;
import com.rightsidetech.trade.entity.TdBuyCarDetail;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TdBuyCarDetailMapper {
    int deleteByPrimaryKey(Long id);

    int deleteByParentId(@Param("parentId") Long parentId);

    int insert(TdBuyCarDetail record);

    int insertSelective(TdBuyCarDetail record);

    TdBuyCarDetail selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TdBuyCarDetail record);

    int updateByPrimaryKey(TdBuyCarDetail record);

    int selectCountByIdListAndUserInfoId(@Param("list") List<Long> list, @Param("userInfoId") Long userInfoId);

    int updateByIdList(@Param("list") List<Long> list);

    TdBuyCarDetail selectByManyCondition(@Param("buyCarId") Long buyCarId, @Param("commodityId") Long commodityId,
                                         @Param("buyType") Byte buyType, @Param("commodityBarCode") String commodityBarCode,
                                         @Param("commodityTag") Byte commodityTag, @Param("parentId") Long parentId);

    List<Long> selectIdsByManyCondition(@Param("buyCarId") Long buyCarId, @Param("commodityId") Long commodityId,
                                         @Param("buyType") Byte buyType, @Param("commodityBarCode") String commodityBarCode,
                                         @Param("commodityTag") Byte commodityTag, @Param("parentId") Long parentId);

    int selectCountByManyCondition(@Param("buyCarId") Long buyCarId, @Param("commodityId") Long commodityId,
                                         @Param("buyType") Byte buyType, @Param("commodityBarCode") String commodityBarCode,
                                         @Param("commodityTag") Byte commodityTag, @Param("parentId") Long parentId);

    TdBuyCarDetail selectByManyConditionExceptId(@Param("buyCarId") Long buyCarId, @Param("commodityId") Long commodityId,
                                         @Param("buyType") Byte buyType, @Param("commodityBarCode") String commodityBarCode,
                                         @Param("commodityTag") Byte commodityTag, @Param("parentId") Long parentId,@Param("id") Long id);

    List<TdBuyCarDetailResp> selectListByBuyCarId(@Param("buyCarId") Long buyCarId, @Param("commodityTag") String commodityTag);

    List<TdBuyCarDetailDelResp> selectZPListByBuyCarId(@Param("buyCarId") Long buyCarId, @Param("commodityTag") String commodityTag);

    List<TdBuyCarDetailZpResp> selectZpListByBuyCarIdAndParentId(@Param("buyCarId") Long buyCarId, @Param("parentId") Long parentId);

    Long selectIdByAllCondition(@Param("buyCarId") Long buyCarId, @Param("commodityId") Long commodityId, @Param("buyType") Byte buyType, @Param("commodityBarCode") String commodityBarCode, @Param("commodityTag") Byte commodityTag);

    List<Long> selectNoneParentIdByBuyCarId(@Param("buyCarId") Long buyCarId);

    List<Long> selectZPIdsByParentId(@Param("parentId") Long parentId);

    TdBuyCarDetail selectByParentId(@Param("parentId") Long parentId);

}